<{include file="ucenter/block/header.html"}>
<div class="ucenter_t">
    <ul><li class="on"><{if $request.act == 'edit'}>编辑商品<{else}>添加商品<{/if}></li></ul>
    <span class="r"><a href="<{link ctl='ucenter/product:index'}>" class="pbtn">商品管理</a></span>
</div>
<div class="ucenter_c">
<{if $group.priv.allow_product < 0}>
    <p class="tips"><span class="lock">您是【<b class="red"><{$group.group_name}></b>】没有权限修改商品</span></p>
<{elseif empty($group.priv.allow_product)}>
    <p class="tips"><span class="notice">您是【<b class="red"><{$group.group_name}></b>】修改商品需要审核</span></p>
<{/if}>
<form action="<{link ctl='ucenter/product:edit'}>" mini-form="ucenter" method="post" ENCTYPE="multipart/form-data">
<input type="hidden" name="product_id" value="<{$detail.product_id}>" />
<table cellspacing="0" cellpadding="0" class="form">
    <tr><th>商品分类：</th>
        <td>
            <strong><{foreach $parents as $v}><{$v.title}> <{if !$v@last}>&nbsp;&gt;&nbsp;<{/if}><{/foreach}></strong>
            <a href="<{link ctl='ucenter/product:edit' arg0=$detail.product_id arg1='edit'}>" style="margin-left:15px;" class="pbtn">编辑分类</a>
        </td>
    </tr>
    <tr><th><span class="red">*</span>标题：</th><td><input type="text" name="data[title]" value="<{$detail.title}>" class="input w-400"/></td></tr>
    <tr><th><span class="red">*</span>名称：</th>
		<td><input type="text" name="data[name]" value="<{$detail.name}>" class="input w-300"/><span class="tip-comment">商品短名称、简称</span></td>
	</tr>
    <{if $cate.brand_ids}>
    <tr><th>品牌：</th><td><select name="data[brand_id]" class="select w-150"><option>--选择--</option><{widget id="shop/brand" cat_id=$cate.cat_id }></select></td></tr>
    <{/if}>
    <tr><th>店铺分类：</th><td><select name="data[vcat_id]" class="select w-150"><option>--选择--</option><{widget id="shop/vcate" shop_id=$shop.shop_id value="<{$detail.vcat_id}>"}></select></td></tr>
    <tr><th class="w-100">地区：</th>
        <td>
            <label><b><{$shop.city_name}></b>&nbsp;&nbsp;&nbsp;</label>
            <select name="data[area_id]" class="select w-100"><{widget id="data/area" value=$detail.area_id city_id=$detail.city_id|default:$shop.city_id}></select>
        </td>
    </tr>
    <tr>
        <th>封面：</th>
        <td>
            <input type="text" name="data[photo]" value="<{$detail.photo}>" <{if $detail.photo}>photo="<{$pager.img}>/<{$detail.photo}>"<{/if}> class="input w-200" />&nbsp;&nbsp;&nbsp;
            <input type="file" name="product_photo" class="input w-100" /><span class="tip-comment">建议图片大小:大于600px * 400px</span>
        </td>
    </tr>
    <tr><th>价格：</th>
        <td>
            <label>市场价:<input type="text" name="data[market_price]" value="<{$detail.market_price|default:'0.00'}>" class="input w-100"/></label>
            <label>商铺价:<input type="text" name="data[price]" value="<{$detail.price|default:'0.00'}>" class="input w-100"/></label>
        </td>
    </tr>
    <tr><th>商品类型：</th>
        <td>
            <ul class="group-list">
                <li><label><input type="radio" name="data[sale_virtual]" value="0" <{if !$detail.sale_virtual}>checked="checked"<{/if}>>实名商品</label></li>
                <li><label><input type="radio" name="data[sale_virtual]" value="1" <{if $detail.sale_virtual}>checked="checked"<{/if}>>虚拟商品</label></li>
                <div class="clear-both"></div>
            </ul>
        </td>
    </tr>
    <tr id="tr_freight"><th>运费：</th>
        <td><input type="text" name="data[freight]" value="<{$detail.freight|default:'0'}>" class="input w-200"/><span class="tip-comment">0：表示包邮</span></td>
    </tr>      
    <tr><th>单位：</th>
        <td><input type="text" name="data[danwei]" value="<{$detail.danwei|default:'个'}>" class="input w-200"/><span class="tip-comment">如:个、件、每平方、每米等</span></td>
    </tr>
     <tr><th>总库存：</th>
        <td><input type="text" name="data[store]" value="<{$detail.store|default:'0'}>" class="input w-200"/></td>
    </tr>
    <tr>
        <th>类型：</th>
        <td>
            <ul class="group-list">
                <li><label><input type="radio" name="data[sale_type]" value="0" <{if empty($detail.sale_type)}>checked="checked"<{/if}>>普通</label></li>
                <li><label><input type="radio" name="data[sale_type]" value="1" <{if $detail.sale_type==1}>checked="checked"<{/if}>>限量</label></li>
                <li><label><input type="radio" name="data[sale_type]" value="2" <{if $detail.sale_type==2}>checked="checked"<{/if}>>限时</label></li>
                <div class="clear-both"></div>
            </ul>
        </td>
    </tr>
    <tr id="tr_sale_time" class="hide"><th>限时：</th><td><input type="text" name="data[sale_time]" value="<{$detail.sale_time|default:''}>" date="sale_time" class="input w-100"/><span class="tip-comment">只有在类型为"限时"时有效</span></td></tr>
   <tr id="tr_sale_sku" class="hide"><th>库存：</th><td><input type="text" name="data[sale_sku]" value="<{$detail.sale_sku|default:''}>" class="input w-100"/><span class="tip-comment">只有在类型为"限量"时有效</span></td></tr>  
    
    <tr>
        <th>在线支付：</th>
        <td>
        <{if $group.priv.product_payment < 0}>
            <input type="hidden" name="data[onpayment]" value="0" />
            <ul class="group-list">
                <li><label><input type="radio" name="onpayment" value="1" disabled="disabled"/>是</label></li>
                <li><label><input type="radio" name="onpayment" checked="checked" value="0" disabled="disabled"/>否</label></li>
            </ul>
            <p class="tips" style="width:650px;float:left;"><span class="notice">您是【<b class="red"><{$group.group_name}></b>】没有权限发布在线购买商品</span></p>
        <{else}>
            <ul class="group-list">
                <li><label><input type="radio" name="data[onpayment]" <{if $detail.onpayment}>checked="checked"<{/if}> value="1"/>是</label></li>
                <li><label><input type="radio" name="data[onpayment]" <{if empty($detail.onpayment)}>checked="checked"<{/if}> value="0"/>否</label></li>
            </ul>
            <{if empty($group.priv.product_payment) && empty($detail.onpayment)}><p class="tips" style="width:650px;float:left;"><span class="notice">您是【<b class="red"><{$group.group_name}></b>】发布在线购买商品需要审核</span></p><{/if}>
        <{/if}>
        </td>
    </tr>
    <tr>
        <th>上架：</th>
        <td>
            <ul class="group-list">
                <li><label><input type="radio" name="data[onsale]" <{if $detail.onsale}>checked="checked"<{/if}> value="1"/>上架</label></li>
                <li><label><input type="radio" name="data[onsale]" <{if empty($detail.onsale)}>checked="checked"<{/if}> value="0"/>下架</label></li>
            </ul>
        </td>
    </tr>
    <{widget id="shop/attr" cat_id=$shop.cat_id value=$detail.attrvalues}>
    <tr><th><span class="red">*</span>商品描述：</th><td><textarea name="fields[info]" kindeditor="full" style="width:700px;height:350px;"><{$detail.info}></textarea><br /></td></tr>
    <tr><th>SEO标题：</th><td><input type="text" name="fields[seo_title]" value="<{$detail.seo_title|default:''}>" class="input w-500"/></td></tr>
    <tr><th>SEO关键字：</th><td><input type="text" name="fields[seo_keywords]" value="<{$detail.seo_keywords|default:''}>" class="input w-500"/></td></tr>
    <tr><th>SEO描述：</th><td><textarea name="fields[seo_description]" class="textarea w-500"><{$detail.seo_description}></textarea><br /></td></tr>   
    <tr><th></th><td><input type="submit" value="提交数据" class="green_btn" /></td></tr>
</table>
</form>
</div>
<script type="text/javascript" src="<{$pager.res}>/kindeditor/kindeditor.js"></script>
<script type="text/javascript" src="<{$pager.res}>/script/jquery.cate_select.js"></script>
<script type="text/javascript">
(function(K, $){
<{if $group.priv.allow_product < 0}>
var editor = KindEditor.create('textarea[kindeditor]',{readonlyMode : true});
$("[mini-form] input,[mini-form] select,[mini-form] textarea").attr("disabled", "disabled");
<{else}>
var editor = KindEditor.create('textarea[kindeditor]',{uploadJson : '<{link ctl="magic:editorupload"}>', extraFileUploadParams:{OTOKEN:"<{$OTOKEN}>"}});
<{/if}>
$("[name='data[sale_type]']").click(function(){
    if($(this).val() == 2){
        $("#tr_sale_sku").hide();
        $("#tr_sale_time").show();
    }else if($(this).val() == 1){
        $("#tr_sale_time").hide();
        $("#tr_sale_sku").show();
    }else{
        $("#tr_sale_sku").hide();
        $("#tr_sale_time").hide();
    }
});
$("[name='data[sale_virtual]']").click(function(){
    if($(this).val() == 1){
        $("#tr_freight").hide();
    }else{
        $("#tr_freight").show();    
    }    
});
$("[name='data[sale_type]']:checked").trigger("click");
$("[name='data[sale_virtual]']:checked").trigger("click");
})(window.KT, window.jQuery);
</script>
<{include file="ucenter/block/footer.html"}>